﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="maintance.aspx.cs" Inherits="BlackHole.blackhole.maintance" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:ListBox ID="lstDevices" runat="server" AutoPostBack="True" 
            onselectedindexchanged="lstDevices_SelectedIndexChanged"></asp:ListBox>
        <asp:ListBox ID="lstDistricts" runat="server" AutoPostBack="True" 
            onselectedindexchanged="lstDistricts_SelectedIndexChanged"></asp:ListBox>
        <asp:ListBox ID="lstOwners" runat="server" AutoPostBack="True" 
            onselectedindexchanged="lstOwners_SelectedIndexChanged"></asp:ListBox>
        <br />
        <br />
        <asp:TextBox ID="txtAddName" runat="server"></asp:TextBox>
        <asp:Button ID="btnAddDevice" runat="server" onclick="btnAddDevice_Click" 
            Text="新增设备" Visible="False" />
        <asp:Button ID="btnAddDistrict" runat="server" onclick="btnAddDistrict_Click" 
            Text="新增区县" Visible="False" />
        <asp:Button ID="btnAddOwner" runat="server" onclick="btnAddOwner_Click" 
            Text="新增网点" Visible="False" />
        <br />
        <asp:Label ID="lblTips" runat="server"></asp:Label>
        <br />
        <br />
        <hr />
        <br />
        <asp:DropDownList ID="comboDistricts" runat="server" 
            DataSourceID="sourceDistricts" DataTextField="DistrictName" 
            DataValueField="Id" AutoPostBack="True">
        </asp:DropDownList>
        <asp:DropDownList ID="comboOwners" runat="server" DataSourceID="sourceOwners" 
            DataTextField="OwnerName" DataValueField="Id" AutoPostBack="True">
        </asp:DropDownList>
        <asp:DropDownList ID="comboDevices" runat="server" DataSourceID="sourceDevices" 
            DataTextField="DeviceName" DataValueField="Id" AutoPostBack="True">
        </asp:DropDownList>
        <asp:Panel ID="panelEdit" runat="server">
            序列号:<asp:TextBox ID="txtUpdateSerialNO" runat="server"></asp:TextBox>
            PSAM卡号:<asp:TextBox ID="txtUpdatePsamNO" runat="server"></asp:TextBox>
            固件版本:<asp:TextBox ID="txtUpdateRomVersion" runat="server"></asp:TextBox>
            <asp:Button ID="btnUpdateProduct" runat="server" onclick="btnUpdateProduct_Click" 
                Text="更新" />
        </asp:Panel>
        <asp:GridView ID="dataProducts" runat="server" AutoGenerateColumns="False" 
            AutoGenerateSelectButton="True" CellPadding="4" ForeColor="#333333" 
            GridLines="Vertical" ShowHeaderWhenEmpty="True" 
            DataKeyNames="Id,ProductDeviceName,ProductDeviceId,ProductDistrictName,ProductOwnerName,SerialNO,PsamNO,RomVersion,StatusId" 
            onselectedindexchanged="dataProducts_SelectedIndexChanged" 
            onpageindexchanged="dataProducts_PageIndexChanged" 
            onpageindexchanging="dataProducts_PageIndexChanging" AllowPaging="True" 
            ondatabinding="dataProducts_DataBinding" 
            DataSourceID="sourceGetProductByOwner">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" 
                    Visible="False" />
                <asp:BoundField DataField="ProductDeviceName" HeaderText="设备类型" 
                    SortExpression="ProductDeviceName" />
                <asp:BoundField DataField="ProductDistrictName" HeaderText="区县" 
                    SortExpression="ProductDistrictName" />
                <asp:BoundField DataField="ProductOwnerName" HeaderText="网点" 
                    SortExpression="ProductOwnerName" />
                <asp:BoundField DataField="StatusId" HeaderText="StatusId" 
                    SortExpression="StatusId" Visible="False" />
                <asp:BoundField DataField="StatusName" HeaderText="状态" 
                    SortExpression="StatusName" />
                <asp:BoundField DataField="SerialNO" HeaderText="序列号" 
                    SortExpression="SerialNO" />
                <asp:BoundField DataField="PsamNO" HeaderText="PSAM卡号" 
                    SortExpression="PsamNO" />
                <asp:BoundField DataField="RomVersion" HeaderText="固件版本" 
                    SortExpression="RomVersion" />
                <asp:BoundField DataField="ProductDeviceId" HeaderText="ProductDeviceId" 
                    Visible="False" />
                <asp:BoundField DataField="RepairCycle" HeaderText="维修次数" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerSettings Mode="NumericFirstLast" PageButtonCount="5" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Right" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="sourceGetProductByOwner" runat="server" 
            EnablePaging="True" SelectCountMethod="GetProductsCountByOwnerId" 
            SelectMethod="GetPagedProductsDetailByOwnerId" TypeName="BlackHole.DAO.Utility">
            <SelectParameters>
                <asp:ControlParameter ControlID="comboDistricts" DefaultValue="0" 
                    Name="districtId" PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="comboOwners" Name="ownerId" 
                    PropertyName="SelectedValue" Type="Int32" />
                <asp:ControlParameter ControlID="comboDevices" DefaultValue="0" Name="deviceId" 
                    PropertyName="SelectedValue" Type="Int32" />
                <asp:Parameter DefaultValue="0" Name="statusId" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
        <asp:ObjectDataSource ID="sourceDistricts" runat="server" 
            TypeName="BlackHole.DAO.Utility" SelectMethod="GetAllDistricts">
        </asp:ObjectDataSource>
    
        <asp:ObjectDataSource ID="sourceOwners" runat="server" 
            TypeName="BlackHole.DAO.Utility" SelectMethod="GetOwnersByDistrictId">
            <SelectParameters>
                <asp:ControlParameter ControlID="comboDistricts" DefaultValue="0" 
                    Name="districtId" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
        <asp:ObjectDataSource ID="sourceDevices" runat="server" 
            SelectMethod="GetAllDevices" TypeName="BlackHole.DAO.Utility">
        </asp:ObjectDataSource>
    
    </div>
    </form>
</body>
</html>
